package JavaSE;

import java.util.HashMap;
import java.util.Map;

public class 待看运算符练习之使用Map同时返回多个值 {
    public static void main(String[] args) {
        int a = 10;
        int b = 5;
        Map<String, Integer> results = performOperations(a, b);

        System.out.println("和: " + results.get("sum"));
        System.out.println("差: " + results.get("difference"));
        System.out.println("积: " + results.get("product"));
        System.out.println("商: " + results.get("quotient"));
        System.out.println("余数: " + results.get("remainder"));
    }

    public static Map<String, Integer> performOperations(int x, int y) {
        Map<String, Integer> results = new HashMap<>();
        results.put("sum", x + y);
        results.put("difference", x - y);
        results.put("product", x * y);
        results.put("quotient", x / y);
        results.put("remainder", x % y);

        return results;
    }
}
